Skip to content

Parser: Introduce StrayERBClosingTagError#1256

Merged
marcoroth merged 2 commits into
mainfrom
parser-stray-erb-closing-error
Feb 28, 2026
Merged

Parser: Introduce StrayERBClosingTagError#1256
marcoroth merged 2 commits into
mainfrom
parser-stray-erb-closing-error

Conversation

@marcoroth

@marcoroth marcoroth commented Feb 28, 2026

Copy link
Copy Markdown
Owner

This pull request introduces a new StrayERBClosingTagError that detects %> appearing outside of ERB tags.

Inside an open tag, the %> is always reported as an error. The parser consumes both tokens, adds a LiteralNode to preserve the source, and continues parsing the tag. Therefore subsequent attributes and the real > closing are not lost anymore:

<div class="foo" %> id="bar">

At the document top level, the %> is reported only in strict mode. In non-strict mode it is silently absorbed as text, matching Erubi's behavior for backwards compatibility, if needed.

<% content %> %>

The error message suggests using &percnt;&gt; HTML entities for cases where a literal %> is intended.

@github-actions

github-actions Bot commented Feb 28, 2026

Copy link
Copy Markdown

🌿 Interactive Playground and Documentation Preview

A preview deployment has been built for this pull request. Try out the changes live in the interactive playground:


🌱 Grown from commit 0c92ad7


✅ Preview deployment has been cleaned up.

@pkg-pr-new

pkg-pr-new Bot commented Feb 28, 2026

Copy link
Copy Markdown
npx https://pkg.pr.new/@herb-tools/formatter@1256
npx https://pkg.pr.new/@herb-tools/language-server@1256
npx https://pkg.pr.new/@herb-tools/linter@1256

commit: 0c92ad7

@marcoroth marcoroth merged commit 892f049 into main Feb 28, 2026
32 checks passed
@marcoroth marcoroth deleted the parser-stray-erb-closing-error branch February 28, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant